#ifndef SELFINFOWIDGET_H
#define SELFINFOWIDGET_H

#include <QDialog>
#include <QWidget>
#include <QIcon>
#include <QCursor>
#include <QLineEdit>
#include <QLabel>
#include <QGridLayout>
#include <QPainter>
#include <QStyleOption>
#include <QFileDialog>
#include <QTimer>
#include <QRegularExpression>

#include "model/data.h"

#define MAX_INTERVAL 30

using model::UserInfo;

class SelfInfoWidget : public QDialog
{
    Q_OBJECT
public:
    SelfInfoWidget(const UserInfo* userInfo, QWidget* parent = nullptr);

    void initSignalsAndSlots();

public slots:
    void clickNameSubmitBtnDone();
    void clickSignatureSubmitBtnDone();
    void clickAvatarDone();
    void clickPhoneSubmitBtnDone();
    void clickVerifyCodeDone();

private:
    // 头像
    QPushButton* m_avatar;
    // 名字
    QLineEdit* m_nameEdit;
    QLabel* m_nameLabel;
    QPushButton* m_nameModifyBtn;
    QPushButton* m_nameSubmitBtn;
    // 签名
    QLineEdit* m_descEdit;
    QLabel* m_descLabel;
    QPushButton* m_descModifyBtn;
    QPushButton* m_descSubmitBtn;
    // 电话
    QLineEdit* m_phoneEdit;
    QLabel* m_phoneLabel;
    QPushButton* m_phoneModifyBtn;
    QPushButton* m_phoneSubmitBtn;
    QLineEdit* m_verifyCodeEdit;
    QPushButton* m_sendVerifyCodeBtn;
    int m_verifyCodeInterval = MAX_INTERVAL;    // 发送验证码的间隙
    // 布局管理器
    QGridLayout* m_gridLayout;
};

#endif // SELFINFOWIDGET_H
